<template>
  <div class="appHeader">
    <h1 class="appHeader-title">后台管理系统</h1>
    <div class="appHeader-menu">
      <el-dropdown @command="logout">
        <span class="el-dropdown-link">
          admin<i class="el-icon-arrow-down el-icon--right"></i>
        </span>
        <el-dropdown-menu slot="dropdown">
          <!-- <el-dropdown-item>修改密码</el-dropdown-item> -->
          <el-dropdown-item>退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </div>
</template>

<script>
import { mapGetters, mapActions } from "vuex";
export default {
  computed: {
    ...mapGetters(["isLogin"]),
  },
  methods: {
    ...mapActions(["setLogin"]),
    logout() {
      console.log("退出登录");
      this.$router.push("/login");
      
      this.setLogin(false)
    },
  },
};
</script>

<style scoped lang="less">
.appHeader {
  height: 80px;
  background-color: #3b4146;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .appHeader-title {
    color: white;
    margin-left: 20px;
  }
  .appHeader-menu {
    margin-right: 20px;
  }
}

.el-dropdown-link {
  cursor: pointer;
  color: #409eff;
}
.el-icon-arrow-down {
  font-size: 12px;
}
</style>